from marker.convert import convert_single_pdf
from marker.models import load_all_models
from ApiTools import apiBase

# pip install marker-pdf  pip install ocrmypdf
# pip install easyocr

# apiTools设置模型的临时目录
# huggingface 必须放在/root/.cache/huggingface/hub
model_lst = load_all_models()

file_path = apiBase.argv(1, '$PROJECT_HOME/200testdata/测试.pdf')
full_text, images, out_meta = convert_single_pdf(file_path, model_lst)
print({"full_text": full_text, "images": images, "out_meta": out_meta})
